"""
由1、10、100、1000、……组成的序列1101001000……，
求这个序列的第N位是0还是1
"""
num, *poses = map(int, input().split())
one_set = {1}
curr_pos, offset = 1, 1
while curr_pos <= 100000000:
    curr_pos += offset
    one_set.add(curr_pos)
    offset += 1
for index in range(num):
    print(1 if poses[index] in one_set else 0, end=' ')
